/*
 *接口编写处...
*如果接口需要做Action的权限验证，请在Action上使用属性
*如: [ApiActionPermission("deviceShare",Enums.ActionPermissionOptions.Search)]
 */
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Http;
using VOL.Entity.DomainModels;
using VOL.RadarDevice.IServices;
using Microsoft.AspNetCore.Authorization;
using VOL.Entity.DomainModels.Devices.Dto;
using VOL.Core.ManageUser;

namespace VOL.RadarDevice.Controllers
{
    public partial class deviceShareController
    {
        private readonly IdeviceShareService _service;//访问业务代码
        private readonly IHttpContextAccessor _httpContextAccessor;

        [ActivatorUtilitiesConstructor]
        public deviceShareController(
            IdeviceShareService service,
            IHttpContextAccessor httpContextAccessor
        )
        : base(service)
        {
            _service = service;
            _httpContextAccessor = httpContextAccessor;
        }
        /// <summary>
        /// 查询测量信息(用于charts显示)
        /// </summary>
        /// <param name="MeasureQueryDto">查询实体</param>
        /// <returns></returns>
        [HttpPost, Route("getDeviceUserIdsByDevId")]
        public async Task<IActionResult> GetDeviceUserIdsByDevId(Guid deviceId)
        {
            return Json(await Service.GetDeviceUserIdsByDevId(deviceId));
        }
        /// <summary>
        /// 更新设备分享用户组
        /// </summary>
        /// <param name="DeviceSharpDto">更新参数</param>
        /// <returns></returns>
        [HttpPost, Route("updateDeviceSharpUserIds"), AllowAnonymous]
        public async Task<IActionResult> UpdateDeviceSharpUserIds([FromBody] DeviceSharpDto dto)
        {
            return Json(await Service.UpdateDeviceSharpUserIds(dto));
        }
    }
}
